package com.ayf.payment.game.api.sms;

import com.ayf.payment.game.api.exception.BusinessException;
import com.swwx.charm.commons.lang.utils.LogPortal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: zh-liang
 * @Date : 2020-04-14 20:48
 */
@Component
public class GetSMSHandler {

    @Autowired
    private ChuangLanSMSHandler chuangLanSMSHandler;

    @Autowired
    private YouXiBaoSMSHandler youXiBaoSMSHandler;

    @Autowired
    private SwMtSMSHandler swMtSMSHandler;
    @Autowired
    private MySMSHandler mySMSHandler;

    public SMSHandler get(String code) {
        if ("chuangLanSMSHandler".equals(code)) {
            return chuangLanSMSHandler;
        } else if ("youXiBaoSMSHandler".equals(code)) {
            return youXiBaoSMSHandler;
        }else if ("swMtSMSHandler".equals(code)) {
            return swMtSMSHandler;
        } else if ("mySMSHandler".equals(code)) {
            return mySMSHandler;
        } else {
            LogPortal.error("短信渠道配置channelCode配置错误[{}]", code);
            throw new BusinessException("短信服务异常");
        }
    }
}
